home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / Dialogs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  24.0 KB  |  755 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Dialogs.h
  3.  
  4.      Contains:    Dialog Manager interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8.1
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1985-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __DIALOGS__
  18. #define __DIALOGS__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __MIXEDMODE__
  24. #include <MixedMode.h>
  25. #endif
  26. #ifndef __EVENTS__
  27. #include <Events.h>
  28. #endif
  29. #ifndef __MACWINDOWS__
  30. #include <MacWindows.h>
  31. #endif
  32. #ifndef __TEXTEDIT__
  33. #include <TextEdit.h>
  34. #endif
  35. #ifndef __CONTROLS__
  36. #include <Controls.h>
  37. #endif
  38.  
  39.  
  40.  
  41. #if PRAGMA_ONCE
  42. #pragma once
  43. #endif
  44.  
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48.  
  49. #if PRAGMA_IMPORT
  50. #pragma import on
  51. #endif
  52.  
  53. #if PRAGMA_STRUCT_ALIGN
  54.     #pragma options align=mac68k
  55. #elif PRAGMA_STRUCT_PACKPUSH
  56.     #pragma pack(push, 2)
  57. #elif PRAGMA_STRUCT_PACK
  58.     #pragma pack(2)
  59. #endif
  60.  
  61.  
  62. enum {
  63.                                                                 /* errors & gestalt*/
  64.     gestaltDialogMgrAttr        = FOUR_CHAR_CODE('dlog'),
  65.     gestaltDialogMgrPresent        = (1L << 0),
  66.     dialogNoTimeoutErr            = -5640
  67. };
  68.  
  69.  
  70.  
  71. enum {
  72.                                                                 /* new, more standard names for dialog item types*/
  73.     kControlDialogItem            = 4,
  74.     kButtonDialogItem            = kControlDialogItem | 0,
  75.     kCheckBoxDialogItem            = kControlDialogItem | 1,
  76.     kRadioButtonDialogItem        = kControlDialogItem | 2,
  77.     kResourceControlDialogItem    = kControlDialogItem | 3,
  78.     kStaticTextDialogItem        = 8,
  79.     kEditTextDialogItem            = 16,
  80.     kIconDialogItem                = 32,
  81.     kPictureDialogItem            = 64,
  82.     kUserDialogItem                = 0,
  83.     kItemDisableBit                = 128
  84. };
  85.  
  86.  
  87. enum {
  88.                                                                 /* old names for dialog item types*/
  89.     ctrlItem                    = 4,
  90.     btnCtrl                        = 0,
  91.     chkCtrl                        = 1,
  92.     radCtrl                        = 2,
  93.     resCtrl                        = 3,
  94.     statText                    = 8,
  95.     editText                    = 16,
  96.     iconItem                    = 32,
  97.     picItem                        = 64,
  98.     userItem                    = 0,
  99.     itemDisable                    = 128
  100. };
  101.  
  102.  
  103. enum {
  104.                                                                 /* standard dialog item numbers*/
  105.     kStdOkItemIndex                = 1,
  106.     kStdCancelItemIndex            = 2,                            /* old names*/
  107.     ok                            = kStdOkItemIndex,
  108.     cancel                        = kStdCancelItemIndex
  109. };
  110.  
  111.  
  112. enum {
  113.                                                                 /* standard icon resource id's     */
  114.     kStopIcon                    = 0,
  115.     kNoteIcon                    = 1,
  116.     kCautionIcon                = 2,                            /* old names*/
  117.     stopIcon                    = kStopIcon,
  118.     noteIcon                    = kNoteIcon,
  119.     cautionIcon                    = kCautionIcon
  120. };
  121.  
  122.  
  123.  
  124.  
  125. #if OLDROUTINENAMES
  126. /*
  127.    These constants lived briefly on ETO 16.  They suggest
  128.    that there is only one index you can use for the OK 
  129.    item, which is not true.  You can put the ok item 
  130.    anywhere you want in the DITL.
  131. */
  132.  
  133. enum {
  134.     kOkItemIndex                = 1,
  135.     kCancelItemIndex            = 2
  136. };
  137.  
  138. #endif  /* OLDROUTINENAMES */
  139.  
  140. /*    Dialog Item List Manipulation Constants    */
  141. typedef SInt16                             DITLMethod;
  142.  
  143. enum {
  144.     overlayDITL                    = 0,
  145.     appendDITLRight                = 1,
  146.     appendDITLBottom            = 2
  147. };
  148.  
  149. typedef SInt16                             StageList;
  150. /* DialogRef is obsolete. Use DialogPtr instead.*/
  151. typedef DialogPtr                         DialogRef;
  152.  
  153. struct DialogRecord {
  154.     WindowRecord                     window;
  155.     Handle                             items;
  156.     TEHandle                         textH;
  157.     SInt16                             editField;
  158.     SInt16                             editOpen;
  159.     SInt16                             aDefItem;
  160. };
  161. typedef struct DialogRecord                DialogRecord;
  162.  
  163. typedef DialogRecord *                    DialogPeek;
  164.  
  165. struct DialogTemplate {
  166.     Rect                             boundsRect;
  167.     SInt16                             procID;
  168.     Boolean                         visible;
  169.     Boolean                         filler1;
  170.     Boolean                         goAwayFlag;
  171.     Boolean                         filler2;
  172.     SInt32                             refCon;
  173.     SInt16                             itemsID;
  174.     Str255                             title;
  175. };
  176. typedef struct DialogTemplate            DialogTemplate;
  177.  
  178. typedef DialogTemplate *                DialogTPtr;
  179. typedef DialogTPtr *                    DialogTHndl;
  180.  
  181. struct AlertTemplate {
  182.     Rect                             boundsRect;
  183.     SInt16                             itemsID;
  184.     StageList                         stages;
  185. };
  186. typedef struct AlertTemplate            AlertTemplate;
  187.  
  188. typedef AlertTemplate *                    AlertTPtr;
  189. typedef AlertTPtr *                        AlertTHndl;
  190. /* new type abstractions for the dialog manager */
  191. typedef SInt16                             DialogItemIndexZeroBased;
  192. typedef SInt16                             DialogItemIndex;
  193. typedef SInt16                             DialogItemType;
  194. /* dialog manager callbacks */
  195. typedef CALLBACK_API( void , SoundProcPtr )(SInt16 soundNumber);
  196. typedef CALLBACK_API( Boolean , ModalFilterProcPtr )(DialogPtr theDialog, EventRecord *theEvent, DialogItemIndex *itemHit);
  197. typedef CALLBACK_API( void , UserItemProcPtr )(WindowPtr theWindow, DialogItemIndex itemNo);
  198. typedef STACK_UPP_TYPE(SoundProcPtr)                             SoundUPP;
  199. typedef STACK_UPP_TYPE(ModalFilterProcPtr)                         ModalFilterUPP;
  200. typedef STACK_UPP_TYPE(UserItemProcPtr)                         UserItemUPP;
  201. enum { uppSoundProcInfo = 0x00000080 };                         /* pascal no_return_value Func(2_bytes) */
  202. enum { uppModalFilterProcInfo = 0x00000FD0 };                     /* pascal 1_byte Func(4_bytes, 4_bytes, 4_bytes) */
  203. enum { uppUserItemProcInfo = 0x000002C0 };                         /* pascal no_return_value Func(4_bytes, 2_bytes) */
  204. #define NewSoundProc(userRoutine)                                 (SoundUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSoundProcInfo, GetCurrentArchitecture())
  205. #define NewModalFilterProc(userRoutine)                         (ModalFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppModalFilterProcInfo, GetCurrentArchitecture())
  206. #define NewUserItemProc(userRoutine)                             (UserItemUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppUserItemProcInfo, GetCurrentArchitecture())
  207. #define CallSoundProc(userRoutine, soundNumber)                 CALL_ONE_PARAMETER_UPP((userRoutine), uppSoundProcInfo, (soundNumber))
  208. #define CallModalFilterProc(userRoutine, theDialog, theEvent, itemHit)  CALL_THREE_PARAMETER_UPP((userRoutine), uppModalFilterProcInfo, (theDialog), (theEvent), (itemHit))
  209. #define CallUserItemProc(userRoutine, theWindow, itemNo)         CALL_TWO_PARAMETER_UPP((userRoutine), uppUserItemProcInfo, (theWindow), (itemNo))
  210.  
  211. #if !TARGET_OS_MAC
  212. /* QuickTime 3.0 */
  213. typedef CALLBACK_API_C( void , QTModelessCallbackProcPtr )(EventRecord *theEvent, DialogPtr theDialog, DialogItemIndex itemHit);
  214. EXTERN_API( void )
  215. SetModelessDialogCallbackProc    (DialogPtr                 theDialog,
  216.                                  QTModelessCallbackProcPtr  callbackProc);
  217.  
  218. EXTERN_API( OSErr )
  219. GetDialogControlNotificationProc (void *                theProc);
  220.  
  221. EXTERN_API( void )
  222. SetDialogMovableModal            (DialogPtr                 theDialog);
  223.  
  224. EXTERN_API( void *)
  225. GetDialogParent                    (DialogPtr                 theDialog);
  226.  
  227. #endif  /* !TARGET_OS_MAC */
  228.  
  229. /*
  230.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  231.       • Following types are valid with Appearance 1.0 and later
  232.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  233. */
  234.  
  235. enum {
  236.                                                                 /* Alert types to pass into StandardAlert */
  237.     kAlertStopAlert                = 0,
  238.     kAlertNoteAlert                = 1,
  239.     kAlertCautionAlert            = 2,
  240.     kAlertPlainAlert            = 3
  241. };
  242.  
  243. typedef SInt16                             AlertType;
  244.  
  245. enum {
  246.     kAlertDefaultOKText            = -1,                            /* "OK"*/
  247.     kAlertDefaultCancelText        = -1,                            /* "Cancel"*/
  248.     kAlertDefaultOtherText        = -1                            /* "Don't Save"*/
  249. };
  250.  
  251. /* StandardAlert alert button numbers */
  252.  
  253. enum {
  254.     kAlertStdAlertOKButton        = 1,
  255.     kAlertStdAlertCancelButton    = 2,
  256.     kAlertStdAlertOtherButton    = 3,
  257.     kAlertStdAlertHelpButton    = 4
  258. };
  259.  
  260.  
  261. enum {
  262.                                                                 /* Dialog Flags for use in NewFeaturesDialog or dlgx resource */
  263.     kDialogFlagsUseThemeBackground = (1 << 0),
  264.     kDialogFlagsUseControlHierarchy = (1 << 1),
  265.     kDialogFlagsHandleMovableModal = (1 << 2),
  266.     kDialogFlagsUseThemeControls = (1 << 3)
  267. };
  268.  
  269.  
  270. enum {
  271.                                                                 /* Alert Flags for use in alrx resource */
  272.     kAlertFlagsUseThemeBackground = (1 << 0),
  273.     kAlertFlagsUseControlHierarchy = (1 << 1),
  274.     kAlertFlagsAlertIsMovable    = (1 << 2),
  275.     kAlertFlagsUseThemeControls    = (1 << 3)
  276. };
  277.  
  278. /* For dftb resource */
  279.  
  280. enum {
  281.     kDialogFontNoFontStyle        = 0,
  282.     kDialogFontUseFontMask        = 0x0001,
  283.     kDialogFontUseFaceMask        = 0x0002,
  284.     kDialogFontUseSizeMask        = 0x0004,
  285.     kDialogFontUseForeColorMask    = 0x0008,
  286.     kDialogFontUseBackColorMask    = 0x0010,
  287.     kDialogFontUseModeMask        = 0x0020,
  288.     kDialogFontUseJustMask        = 0x0040,
  289.     kDialogFontUseAllMask        = 0x00FF,
  290.     kDialogFontAddFontSizeMask    = 0x0100,
  291.     kDialogFontUseFontNameMask    = 0x0200,
  292.     kDialogFontAddToMetaFontMask = 0x0400
  293. };
  294.  
  295.  
  296. struct AlertStdAlertParamRec {
  297.     Boolean                         movable;                    /* Make alert movable modal */
  298.     Boolean                         helpButton;                    /* Is there a help button? */
  299.     ModalFilterUPP                     filterProc;                    /* Event filter */
  300.     StringPtr                         defaultText;                /* Text for button in OK position */
  301.     StringPtr                         cancelText;                    /* Text for button in cancel position */
  302.     StringPtr                         otherText;                    /* Text for button in left position */
  303.     SInt16                             defaultButton;                /* Which button behaves as the default */
  304.     SInt16                             cancelButton;                /* Which one behaves as cancel (can be 0) */
  305.     UInt16                             position;                    /* Position (kWindowDefaultPosition in this case */
  306.                                                                 /* equals kWindowAlertPositionParentWindowScreen) */
  307. };
  308. typedef struct AlertStdAlertParamRec    AlertStdAlertParamRec;
  309.  
  310. typedef AlertStdAlertParamRec *            AlertStdAlertParamPtr;
  311. /* ——— end Appearance 1.0 or later stuff*/
  312.  
  313.  
  314.  
  315.  
  316.  
  317. /*
  318.     NOTE: Code running under MultiFinder or System 7.0 or newer
  319.     should always pass NULL to InitDialogs.
  320. */
  321. EXTERN_API( void )
  322. InitDialogs                        (void *                    ignored)                            ONEWORDINLINE(0xA97B);
  323.  
  324. EXTERN_API( void )
  325. ErrorSound                        (SoundUPP                 soundProc)                            ONEWORDINLINE(0xA98C);
  326.  
  327. EXTERN_API( DialogPtr )
  328. NewDialog                        (void *                    dStorage,
  329.                                  const Rect *            boundsRect,
  330.                                  ConstStr255Param         title,
  331.                                  Boolean                 visible,
  332.                                  SInt16                 procID,
  333.                                  WindowPtr                 behind,
  334.                                  Boolean                 goAwayFlag,
  335.                                  SInt32                 refCon,
  336.                                  Handle                 items)                                ONEWORDINLINE(0xA97D);
  337.  
  338. EXTERN_API( DialogPtr )
  339. GetNewDialog                    (SInt16                 dialogID,
  340.                                  void *                    dStorage,
  341.                                  WindowPtr                 behind)                                ONEWORDINLINE(0xA97C);
  342.  
  343. EXTERN_API( DialogPtr )
  344. NewColorDialog                    (void *                    dStorage,
  345.                                  const Rect *            boundsRect,
  346.                                  ConstStr255Param         title,
  347.                                  Boolean                 visible,
  348.                                  SInt16                 procID,
  349.                                  WindowPtr                 behind,
  350.                                  Boolean                 goAwayFlag,
  351.                                  SInt32                 refCon,
  352.                                  Handle                 items)                                ONEWORDINLINE(0xAA4B);
  353.  
  354. EXTERN_API( void )
  355. CloseDialog                        (DialogPtr                 theDialog)                            ONEWORDINLINE(0xA982);
  356.  
  357. EXTERN_API( void )
  358. DisposeDialog                    (DialogPtr                 theDialog)                            ONEWORDINLINE(0xA983);
  359.  
  360. EXTERN_API( void )
  361. ModalDialog                        (ModalFilterUPP         modalFilter,
  362.                                  DialogItemIndex *        itemHit)                            ONEWORDINLINE(0xA991);
  363.  
  364. EXTERN_API( Boolean )
  365. IsDialogEvent                    (const EventRecord *    theEvent)                            ONEWORDINLINE(0xA97F);
  366.  
  367. EXTERN_API( Boolean )
  368. DialogSelect                    (const EventRecord *    theEvent,
  369.                                  DialogPtr *            theDialog,
  370.                                  DialogItemIndex *        itemHit)                            ONEWORDINLINE(0xA980);
  371.  
  372. EXTERN_API( void )
  373. DrawDialog                        (DialogPtr                 theDialog)                            ONEWORDINLINE(0xA981);
  374.  
  375. EXTERN_API( void )
  376. UpdateDialog                    (DialogPtr                 theDialog,
  377.                                  RgnHandle                 updateRgn)                            ONEWORDINLINE(0xA978);
  378.  
  379. EXTERN_API( void )
  380. HideDialogItem                    (DialogPtr                 theDialog,
  381.                                  DialogItemIndex         itemNo)                                ONEWORDINLINE(0xA827);
  382.  
  383. EXTERN_API( void )
  384. ShowDialogItem                    (DialogPtr                 theDialog,
  385.                                  DialogItemIndex         itemNo)                                ONEWORDINLINE(0xA828);
  386.  
  387. EXTERN_API( DialogItemIndexZeroBased )
  388. FindDialogItem                    (DialogPtr                 theDialog,
  389.                                  Point                     thePt)                                ONEWORDINLINE(0xA984);
  390.  
  391. EXTERN_API( void )
  392. DialogCut                        (DialogPtr                 theDialog);
  393.  
  394. EXTERN_API( void )
  395. DialogPaste                        (DialogPtr                 theDialog);
  396.  
  397. EXTERN_API( void )
  398. DialogCopy                        (DialogPtr                 theDialog);
  399.  
  400. EXTERN_API( void )
  401. DialogDelete                    (DialogPtr                 theDialog);
  402.  
  403. EXTERN_API( DialogItemIndex )
  404. Alert                            (SInt16                 alertID,
  405.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA985);
  406.  
  407. EXTERN_API( DialogItemIndex )
  408. StopAlert                        (SInt16                 alertID,
  409.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA986);
  410.  
  411. EXTERN_API( DialogItemIndex )
  412. NoteAlert                        (SInt16                 alertID,
  413.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA987);
  414.  
  415. EXTERN_API( DialogItemIndex )
  416. CautionAlert                    (SInt16                 alertID,
  417.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA988);
  418.  
  419. EXTERN_API( void )
  420. GetDialogItem                    (DialogPtr                 theDialog,
  421.                                  DialogItemIndex         itemNo,
  422.                                  DialogItemType *        itemType,
  423.                                  Handle *                item,
  424.                                  Rect *                    box)                                ONEWORDINLINE(0xA98D);
  425.  
  426. EXTERN_API( void )
  427. SetDialogItem                    (DialogPtr                 theDialog,
  428.                                  DialogItemIndex         itemNo,
  429.                                  DialogItemType         itemType,
  430.                                  Handle                 item,
  431.                                  const Rect *            box)                                ONEWORDINLINE(0xA98E);
  432.  
  433. EXTERN_API( void )
  434. ParamText                        (ConstStr255Param         param0,
  435.                                  ConstStr255Param         param1,
  436.                                  ConstStr255Param         param2,
  437.                                  ConstStr255Param         param3)                                ONEWORDINLINE(0xA98B);
  438.  
  439. EXTERN_API( void )
  440. SelectDialogItemText            (DialogPtr                 theDialog,
  441.                                  DialogItemIndex         itemNo,
  442.                                  SInt16                 strtSel,
  443.                                  SInt16                 endSel)                                ONEWORDINLINE(0xA97E);
  444.  
  445. EXTERN_API( void )
  446. GetDialogItemText                (Handle                 item,
  447.                                  Str255                 text)                                ONEWORDINLINE(0xA990);
  448.  
  449. EXTERN_API( void )
  450. SetDialogItemText                (Handle                 item,
  451.                                  ConstStr255Param         text)                                ONEWORDINLINE(0xA98F);
  452.  
  453. EXTERN_API( SInt16 )
  454. GetAlertStage                    (void)                                                        TWOWORDINLINE(0x3EB8, 0x0A9A);
  455.  
  456. EXTERN_API( void )
  457. SetDialogFont                    (SInt16                 fontNum)                            TWOWORDINLINE(0x31DF, 0x0AFA);
  458.  
  459. EXTERN_API( void )
  460. ResetAlertStage                    (void)                                                        TWOWORDINLINE(0x4278, 0x0A9A);
  461.  
  462.  
  463. #if CGLUESUPPORTED
  464. EXTERN_API_C( DialogPtr )
  465. newdialog                        (void *                    dStorage,
  466.                                  const Rect *            boundsRect,
  467.                                  const char *            title,
  468.                                  Boolean                 visible,
  469.                                  SInt16                 procID,
  470.                                  WindowPtr                 behind,
  471.                                  Boolean                 goAwayFlag,
  472.                                  SInt32                 refCon,
  473.                                  Handle                 items);
  474.  
  475. EXTERN_API_C( DialogPtr )
  476. newcolordialog                    (void *                    dStorage,
  477.                                  const Rect *            boundsRect,
  478.                                  const char *            title,
  479.                                  Boolean                 visible,
  480.                                  SInt16                 procID,
  481.                                  WindowPtr                 behind,
  482.                                  Boolean                 goAwayFlag,
  483.                                  SInt32                 refCon,
  484.                                  Handle                 items);
  485.  
  486. EXTERN_API_C( void )
  487. paramtext                        (const char *            param0,
  488.                                  const char *            param1,
  489.                                  const char *            param2,
  490.                                  const char *            param3);
  491.  
  492. EXTERN_API_C( void )
  493. getdialogitemtext                (Handle                 item,
  494.                                  char *                    text);
  495.  
  496. EXTERN_API_C( void )
  497. setdialogitemtext                (Handle                 item,
  498.                                  const char *            text);
  499.  
  500. EXTERN_API_C( DialogItemIndexZeroBased )
  501. finddialogitem                    (DialogPtr                 theDialog,
  502.                                  Point *                thePt);
  503.  
  504. #endif  /* CGLUESUPPORTED */
  505.  
  506. EXTERN_API( void )
  507. AppendDITL                        (DialogPtr                 theDialog,
  508.                                  Handle                 theHandle,
  509.                                  DITLMethod             method);
  510.  
  511. EXTERN_API( DialogItemIndex )
  512. CountDITL                        (DialogPtr                 theDialog);
  513.  
  514. EXTERN_API( void )
  515. ShortenDITL                        (DialogPtr                 theDialog,
  516.                                  DialogItemIndex         numberItems);
  517.  
  518. EXTERN_API( Boolean )
  519. StdFilterProc                    (DialogPtr                 theDialog,
  520.                                  EventRecord *            event,
  521.                                  DialogItemIndex *        itemHit);
  522.  
  523. EXTERN_API( OSErr )
  524. GetStdFilterProc                (ModalFilterUPP *        theProc)                            THREEWORDINLINE(0x303C, 0x0203, 0xAA68);
  525.  
  526. EXTERN_API( OSErr )
  527. SetDialogDefaultItem            (DialogPtr                 theDialog,
  528.                                  DialogItemIndex         newItem)                            THREEWORDINLINE(0x303C, 0x0304, 0xAA68);
  529.  
  530. EXTERN_API( OSErr )
  531. SetDialogCancelItem                (DialogPtr                 theDialog,
  532.                                  DialogItemIndex         newItem)                            THREEWORDINLINE(0x303C, 0x0305, 0xAA68);
  533.  
  534. EXTERN_API( OSErr )
  535. SetDialogTracksCursor            (DialogPtr                 theDialog,
  536.                                  Boolean                 tracks)                                THREEWORDINLINE(0x303C, 0x0306, 0xAA68);
  537.  
  538.  
  539.  
  540. /*
  541.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  542.       • Appearance Dialog Routines (available only with Appearance 1.0 and later)
  543.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  544. */
  545.  
  546. EXTERN_API( DialogPtr )
  547. NewFeaturesDialog                (void *                    inStorage,
  548.                                  const Rect *            inBoundsRect,
  549.                                  ConstStr255Param         inTitle,
  550.                                  Boolean                 inIsVisible,
  551.                                  SInt16                 inProcID,
  552.                                  WindowPtr                 inBehind,
  553.                                  Boolean                 inGoAwayFlag,
  554.                                  SInt32                 inRefCon,
  555.                                  Handle                 inItemListHandle,
  556.                                  UInt32                 inFlags)                            THREEWORDINLINE(0x303C, 0x110C, 0xAA68);
  557.  
  558. EXTERN_API( OSErr )
  559. AutoSizeDialog                    (DialogPtr                 inDialog)                            THREEWORDINLINE(0x303C, 0x020D, 0xAA68);
  560.  
  561. EXTERN_API( OSErr )
  562. StandardAlert                    (AlertType                 inAlertType,
  563.                                  StringPtr                 inError,
  564.                                  StringPtr                 inExplanation,
  565.                                  AlertStdAlertParamPtr     inAlertParam,
  566.                                  SInt16 *                outItemHit)                            THREEWORDINLINE(0x303C, 0x090E, 0xAA68);
  567.  
  568. EXTERN_API( OSErr )
  569. GetDialogItemAsControl            (DialogPtr                 inDialog,
  570.                                  SInt16                 inItemNo,
  571.                                  ControlHandle *        outControl)                            THREEWORDINLINE(0x303C, 0x050F, 0xAA68);
  572.  
  573. EXTERN_API( OSErr )
  574. MoveDialogItem                    (DialogPtr                 inDialog,
  575.                                  SInt16                 inItemNo,
  576.                                  SInt16                 inHoriz,
  577.                                  SInt16                 inVert)                                THREEWORDINLINE(0x303C, 0x0510, 0xAA68);
  578.  
  579. EXTERN_API( OSErr )
  580. SizeDialogItem                    (DialogPtr                 inDialog,
  581.                                  SInt16                 inItemNo,
  582.                                  SInt16                 inWidth,
  583.                                  SInt16                 inHeight)                            THREEWORDINLINE(0x303C, 0x0511, 0xAA68);
  584.  
  585. EXTERN_API( OSErr )
  586. AppendDialogItemList            (DialogPtr                 dialog,
  587.                                  SInt16                 ditlID,
  588.                                  DITLMethod             method)                                THREEWORDINLINE(0x303C, 0x0412, 0xAA68);
  589.  
  590. /*
  591.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  592.       • Dialog Routines available only with Appearance 1.1 and later
  593.   —————————————————————————————————————————————————————————————————————————————————————————————————————————
  594. */
  595.  
  596. EXTERN_API( OSStatus )
  597. SetDialogTimeout                (DialogPtr                 inDialog,
  598.                                  SInt16                 inButtonToPress,
  599.                                  UInt32                 inSecondsToWait);
  600.  
  601. EXTERN_API( OSStatus )
  602. GetDialogTimeout                (DialogPtr                 inDialog,
  603.                                  SInt16 *                outButtonToPress,
  604.                                  UInt32 *                outSecondsToWait,
  605.                                  UInt32 *                outSecondsRemaining);
  606.  
  607. EXTERN_API( OSStatus )
  608. SetModalDialogEventMask            (DialogPtr                 inDialog,
  609.                                  EventMask                 inMask);
  610.  
  611. EXTERN_API( OSStatus )
  612. GetModalDialogEventMask            (DialogPtr                 inDialog,
  613.                                  EventMask *            outMask);
  614.  
  615. #if OLDROUTINENAMES
  616. #define DisposDialog(theDialog) DisposeDialog(theDialog)
  617. #define UpdtDialog(theDialog, updateRgn) UpdateDialog(theDialog, updateRgn)
  618. #define GetDItem(theDialog, itemNo, itemType, item, box) GetDialogItem(theDialog, itemNo, itemType, item, box)
  619. #define SetDItem(theDialog, itemNo, itemType, item, box) SetDialogItem(theDialog, itemNo, itemType, item, box)
  620. #define HideDItem(theDialog, itemNo) HideDialogItem(theDialog, itemNo)
  621. #define ShowDItem(theDialog, itemNo) ShowDialogItem(theDialog, itemNo)
  622. #define SelIText(theDialog, itemNo, strtSel, endSel) SelectDialogItemText(theDialog, itemNo, strtSel, endSel)
  623. #define GetIText(item, text) GetDialogItemText(item, text)
  624. #define SetIText(item, text) SetDialogItemText(item, text)
  625. #define FindDItem(theDialog, thePt) FindDialogItem(theDialog, thePt)
  626. #define NewCDialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items) \
  627. NewColorDialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items)
  628. #define GetAlrtStage() GetAlertStage()
  629. #define ResetAlrtStage() ResetAlertStage()
  630. #define DlgCut(theDialog) DialogCut(theDialog)
  631. #define DlgPaste(theDialog) DialogPaste(theDialog)
  632. #define DlgCopy(theDialog) DialogCopy(theDialog)
  633. #define DlgDelete(theDialog) DialogDelete(theDialog)
  634. #define SetDAFont(fontNum) SetDialogFont(fontNum)
  635. #if CGLUESUPPORTED
  636. #define newcdialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items) \
  637. newcolordialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items)
  638. #define getitext(item, text) getdialogitemtext(item, text)
  639. #define setitext(item, text) setdialogitemtext(item, text)
  640. #define findditem(theDialog, thePt) finddialogitem(theDialog, thePt)
  641. #endif  /* CGLUESUPPORTED */
  642.  
  643. #endif  /* OLDROUTINENAMES */
  644.  
  645. /*
  646.     *****************************************************************************
  647.     *                                                                           *
  648.     * The conditional STRICT_DIALOGS has been removed from this interface file. *
  649.     * The accessor macros to a DialogRecord are no longer necessary.            *
  650.     *                                                                           *
  651.     * All ≈Ref Types have reverted to their original Handle and Ptr Types.      *
  652.     *                                                                           *
  653.     *****************************************************************************
  654.  
  655.     Details:
  656.     The original purpose of the STRICT_ conditionals and accessor macros was to
  657.     help ease the transition to Copland.  Shared data structures are difficult
  658.     to coordinate in a preemptive multitasking OS.  By hiding the fields in a
  659.     WindowRecord and other data structures, we would begin the migration to the
  660.     discipline wherein system data structures are completely hidden from
  661.     applications.
  662.     
  663.     After many design reviews, we finally concluded that with this sort of
  664.     migration, the system could never tell when an application was no longer
  665.     peeking at a WindowRecord, and thus the data structure might never become
  666.     system owned.  Additionally, there were many other limitations in the
  667.     classic toolbox that were begging to be addressed.  The final decision was
  668.     to leave the traditional toolbox as a compatibility mode.
  669.     
  670.     We also decided to use the Handle and Ptr based types in the function
  671.     declarations.  For example, NewWindow now returns a WindowPtr rather than a
  672.     WindowRef.  The Ref types are still defined in the header files, so all
  673.     existing code will still compile exactly as it did before.  There are
  674.     several reasons why we chose to do this:
  675.     
  676.     - The importance of backwards compatibility makes it unfeasible for us to
  677.     enforce real opaque references in the implementation anytime in the
  678.     foreseeable future.  Therefore, any opaque data types (e.g. WindowRef,
  679.     ControlRef, etc.) in the documentation and header files would always be a
  680.     fake veneer of opacity.
  681.     
  682.     - There exists a significant base of books and sample code that neophyte
  683.     Macintosh developers use to learn how to program the Macintosh.  These
  684.     books and sample code all use direct data access.  Introducing opaque data
  685.     types at this point would confuse neophyte programmers more than it would
  686.     help them.
  687.     
  688.     - Direct data structure access is used by nearly all Macintosh developers. 
  689.     Changing the interfaces to reflect a false opacity would not provide any
  690.     benefit to these developers.
  691.     
  692.     - Accessor functions are useful in and of themselves as convenience
  693.     functions, without being tied to opaque data types.  We will complete and
  694.     document the Windows and Dialogs accessor functions in an upcoming release
  695.     of the interfaces.
  696. */
  697. #ifdef __cplusplus
  698. inline WindowPtr     GetDialogWindow(DialogPtr dialog)        { return (WindowPtr) dialog;                         }
  699. inline SInt16        GetDialogDefaultItem(DialogPtr dialog)  { return (*(SInt16 *) (((UInt8 *) dialog) + 168));    }
  700. inline SInt16        GetDialogCancelItem(DialogPtr dialog)     { return (*(SInt16 *) (((UInt8 *) dialog) + 166));    }
  701. inline SInt16        GetDialogKeyboardFocusItem(DialogPtr dialog)    { return (SInt16) ((*(SInt16 *) (((UInt8 *) dialog) + 164)) < 0 ? -1 : (*(SInt16 *) (((UInt8 *) dialog) + 164)) + 1); }
  702. inline void        SetGrafPortOfDialog(DialogPtr dialog) { MacSetPort ((GrafPtr) dialog); }
  703. #else
  704. #define GetDialogWindow(dialog)    ((WindowPtr) dialog)
  705. #define GetDialogDefaultItem(dialog) (*(SInt16 *) (((UInt8 *) dialog) + 168))
  706. #define GetDialogCancelItem(dialog) (*(SInt16 *) (((UInt8 *) dialog) + 166))
  707. #define GetDialogKeyboardFocusItem(dialog) ((SInt16)((*(SInt16 *) (((UInt8 *) dialog) + 164)) < 0 ? -1 : (*(SInt16 *) (((UInt8 *) dialog) + 164)) + 1))
  708. #define SetGrafPortOfDialog(dialog) do { MacSetPort ((GrafPtr) dialog); } while (false)
  709. #endif
  710.  
  711. EXTERN_API( void )
  712. CouldDialog                        (SInt16                 dialogID)                            ONEWORDINLINE(0xA979);
  713.  
  714. EXTERN_API( void )
  715. FreeDialog                        (SInt16                 dialogID)                            ONEWORDINLINE(0xA97A);
  716.  
  717. EXTERN_API( void )
  718. CouldAlert                        (SInt16                 alertID)                            ONEWORDINLINE(0xA989);
  719.  
  720. EXTERN_API( void )
  721. FreeAlert                        (SInt16                 alertID)                            ONEWORDINLINE(0xA98A);
  722.  
  723.  
  724.  
  725.  
  726.  
  727. #if !TARGET_OS_MAC
  728. #endif  /* !TARGET_OS_MAC */
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735. #if PRAGMA_STRUCT_ALIGN
  736.     #pragma options align=reset
  737. #elif PRAGMA_STRUCT_PACKPUSH
  738.     #pragma pack(pop)
  739. #elif PRAGMA_STRUCT_PACK
  740.     #pragma pack()
  741. #endif
  742.  
  743. #ifdef PRAGMA_IMPORT_OFF
  744. #pragma import off
  745. #elif PRAGMA_IMPORT
  746. #pragma import reset
  747. #endif
  748.  
  749. #ifdef __cplusplus
  750. }
  751. #endif
  752.  
  753. #endif /* __DIALOGS__ */
  754.  
  755.